<div class="j-sidebar j-block">
    <div class="j-sidebar__header">
        <span class="btn-area">Top <%= newestLength %></span>
        <h3 class="title">最新文章</h3>
    </div>
    <div class="j-sidebar__body">
        <%
        var post, category, categoryName, postDate, title, url, commentNum, readNum = 0, likeNum = 0;
        for (var i = 0; i < posts.length;i++){
            post = posts[i]
            category = groupBy(post.terms, 'taxonomy').category
            categoryName = category[0].name
            postDate = formatDate(post.post_date, 'YYYY/M/D hh:mm')
            commentNum = post.comment_count || 0
            title = post.post_title
            // if (title.length > 21) {
            //     title = title.substr(0, 21)
            // }
            url = '/article/' + post.guid
        %>
        <div class="j-article--sidebar">
            <!-- 标题长度最大支持21-->
            <h3 class="j-article__title" title="<%= title %>">
                <a href="<%= url %>" target="_blank"><%= title %></a>
            </h3>
            <div class="j-article__metas">
                <a href="javascript:void(0);" class="category"><%= categoryName %></a>
                <time datetime="<%= postDate %>" class="time"><%= postDate %></time>
            </div>
        </div>
        <% } %>
    </div>
</div>
